package server.persistencia;

import herramientas.Agente_Properties;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;



public abstract class DAOFactory {
	public abstract DAOBeneficiario crearDAOBeneficiario() throws SQLException;
	public abstract DAOCentro crearDAOCentro() throws SQLException;

	public abstract DAODescripcionRol crearDAODescripcionRol() throws SQLException;
	public abstract DAOMedico crearDAOMedico() throws SQLException;
	public abstract DAOUsuario crearDAOUsuario() throws SQLException;
	public abstract DAOHora crearDAOHora() throws SQLException;
        public abstract DAOCita crearDAOCita() throws SQLException;
	public static DAOFactory getFactory(){
            int opcion=1;
            try {
                Agente_Properties agentep = Agente_Properties.getAgenteProperties();
                opcion = Integer.parseInt(agentep.getProperty("bbdd.tipo"));

            } catch (FileNotFoundException ex) {
                Logger.getLogger(DAOFactory.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(DAOFactory.class.getName()).log(Level.SEVERE, null, ex);
            }
            switch (opcion) {
                case 1:
                    return new MySQLDAOFactory();
                default:
                    break;


            }
            return null;
	}
}
